#!/usr/bin/python
# Filename: 17.py
import Image
import urllib
import StringIO
import sys
from os import sep as PSEP
#print PSEP
cwd = sys.path[0]+PSEP
# idata = urllib.urlopen('http://huge:file@www.pythonchallenge.com/pc/return/mozart.gif').read()
# im = Image.open(StringIO.StringIO(idata))
im = Image.open(cwd+"resources"+PSEP+"mozart.gif")
w, h = im.size
#a test code has wrote to get the piexl value of pink is 195(0xC3)

for j in range(h):
	line = [im.getpixel((i, j)) for i in range(w)]
	for i in range(w):
		if(195 == im.getpixel((i, j))):
			break
	line = line[i:]+line[:i]
	[im.putpixel((i, j), line[i]) for i in range(w)]
im.save(cwd+"output"+PSEP+"16.gif")